﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MyProject.JQueryStudies.Models
{
    public static class PortalHelper
    {
        public static Portal GetPortal()
        {
            var sysCfgPanel = new Panel()
            {
                Code = "SYS_CONFIG",
                Name = "系统配置"
            };

            sysCfgPanel.Setting.Title = "系统配置";
            sysCfgPanel.Setting.Icon = "setting";
            sysCfgPanel.Setting.TemplateCode = "SYS_CONFIG";
            sysCfgPanel.Setting.DataCode = "SYS_CONFIG";

            var orgCfgPanel = new Panel()
            {
                Code = "ORG_CONFIG",
                Name = "组织权限管理"
            };

            orgCfgPanel.Setting.Title = "组织权限管理";
            orgCfgPanel.Setting.Icon = "org";
            sysCfgPanel.Setting.TemplateCode = sysCfgPanel.Setting.DataCode = orgCfgPanel.Code;

            var wfCfgPanel = new Panel()
            {
                Code = "WF_CONFIG",
                Name = "工作流管理"
            };

            wfCfgPanel.Setting.Title = "工作流管理";
            wfCfgPanel.Setting.Icon = "flow";
            wfCfgPanel.Setting.TemplateCode = wfCfgPanel.Setting.DataCode = wfCfgPanel.Code;

            var docCfgPanel = new Panel()
            {
                Code = "DOC_CONFIG",
                Name = "文档管理"
            };

            docCfgPanel.Setting.Title = "文档管理";
            docCfgPanel.Setting.Icon = "doc";
            docCfgPanel.Setting.TemplateCode = docCfgPanel.Setting.DataCode = docCfgPanel.Code;

            var settingPage = new Page()
            {
                Code = "SYS_SETTING",
                Name = "系统设置"
            };

            settingPage.Setting.OrderNO = 0;
            settingPage.Setting.Title = "系统设置";

            settingPage.Panels.Add(sysCfgPanel);
            settingPage.Panels.Add(orgCfgPanel);
            settingPage.Panels.Add(wfCfgPanel);
            settingPage.Panels.Add(docCfgPanel);

            var portal = new Portal()
            {
                Code = "HOME",
                Name = "主页"
            };

            portal.Pages.Add(settingPage);

            return portal;
        }
    }
}